﻿<%@ Control Language="C#" AutoEventWireup="true" CodeFile="ControlMappingSanPham.ascx.cs" Inherits="UserControl_ControlMappingSanPham" %>
<%@ Register Assembly="AjaxControlToolkit" Namespace="AjaxControlToolkit" TagPrefix="cc1" %>
  <%@ Register assembly="DevExpress.Web.v9.2, Version=9.2.6.0, Culture=neutral, PublicKeyToken=b88d1754d700e49a" namespace="DevExpress.Web.ASPxPopupControl" tagprefix="dxpc" %>


  <script type="text/javascript">
      function pageLoad() {

          //giá mặt hàng
          $("#<%= txtPrice.ClientID %>").numeric({ allow: "." });

          $("#<%= imgBtnAdd.ClientID %>").click(function () {
              $.blockUI({ css: {
                  border: 'none',
                  padding: '15px',
                  backgroundColor: '#000',
                  '-webkit-border-radius': '10px',
                  '-moz-border-radius': '10px',
                  opacity: .5,
                  color: '#fff'
              }
              });
          });
      $("#<%= btnSave.ClientID %>").click(function () {
         if ($("#<%= txtFimexSP.ClientID %>").val().length > 0)
              $.blockUI({ css: {
                  border: 'none',
                  padding: '15px',
                  backgroundColor: '#000',
                  '-webkit-border-radius': '10px',
                  '-moz-border-radius': '10px',
                  opacity: .5,
                  color: '#fff'
              }
              });
              }
          });

         

         
      $("#<%= imgBtnDelete.ClientID %>").click(function () {
          $.blockUI({ css: {
              border: 'none',
              padding: '15px',
              backgroundColor: '#000',
              '-webkit-border-radius': '10px',
              '-moz-border-radius': '10px',
              opacity: .5,
              color: '#fff'
          }
          });
      });

          Sys.WebForms.PageRequestManager.getInstance().add_endRequest(EndRequestHandler);
          function EndRequestHandler(sender, args) {
              $.unblockUI();
          }
      }

</script>
 <asp:UpdatePanel ID="UpdatePanel1" runat="server">
    <ContentTemplate>
      <dxpc:ASPxPopupControl ID="MessageBoxUserGroup" PopupHorizontalAlign="WindowCenter"  PopupVerticalAlign="TopSides" Font-Bold="true" HeaderText="Chọn sản phẩm" 
            runat="server" Width="600px" Modal="true" ShowPageScrollbarWhenModal="true" ShowCloseButton="true" CloseAction="CloseButton" >                
                <ContentCollection>
                    <dxpc:PopupControlContentControl ID="PopupControlContentControl4" runat="server" SupportsDisabledAttribute="True">
                       
                                    <!-- Content main-->
                                    <div class="direct_container_main">
                                        <div class="direct_container_form_right">
                                            <table border="0" width="100%">
                                            
                                                 <tr>
                                                    <td colspan="2" align="center">
                                                       
                                                        <asp:Label ID="lblSelectSPFor" runat="server" Text=""></asp:Label>
                                                    </td>
                                                </tr>
                                                 <tr>
                                                <td width="10%" align="right"><p class="direct_label">Group</p></td>
                                                <td width="90%" align="left">
                                                        <asp:DropDownList AutoPostBack="true"
                                                                        onselectedindexchanged="DropGroup_SelectedIndexChanged" ID="DropGroup" runat="server">
                                                        </asp:DropDownList>
                                                </td>
                                                </tr>
                                                 <tr>
                                                <td width="10%" align="right"><p class="direct_label">Channel</p></td>
                                                <td width="90%" align="left">     
                                                        <asp:DropDownList ID="DropChannel" runat="server">
                                                        </asp:DropDownList>
                                                    <asp:Button ID="btGetSP" runat="server" CssClass="direct_bt_search" Text="Lấy thông tin" 
                                                        onclick="btGetSP_Click" />
                                                </td>
                                                </tr>
                                                 <tr>
                                                    <td colspan="2">
                                                    <asp:GridView ID="grvSP" runat="server" AutoGenerateColumns="False" 
                                         OnPageIndexChanging="grvSP_PageIndexChanging" OnRowCommand="grvSP_RowCommand"
                                         PageSize="10" AllowPaging="true"
                                         DataKeyNames="itemkey" EnableModelValidation="True">
                                         <Columns>
                           
                            <asp:TemplateField HeaderText="Stt">
                                <HeaderTemplate>
                                                                    STT
                                                                
                                         
                                </HeaderTemplate>
                            <ItemTemplate>
                                                                    <%# Container.DataItemIndex + 1 %>
                                                                
</ItemTemplate>

<HeaderStyle HorizontalAlign="Left" Width="50px" />

<ItemStyle Height="40px" HorizontalAlign="Left" Width="50px" />
</asp:TemplateField>
                            <asp:TemplateField HeaderText="Mã sản phẩm(SKU)"><HeaderTemplate>
                                                                    Mã sản phẩm(SKU)
                                                                
</HeaderTemplate>
<ItemTemplate>
                                                                  
                  <asp:Label ID="lblitemkey" runat="server" Text='<%# Eval("itemkey")%>'></asp:Label>                                               
</ItemTemplate>

<HeaderStyle HorizontalAlign="Left" Width="150px" />

<ItemStyle Height="40px" HorizontalAlign="Left" Width="150px" />
</asp:TemplateField>
                            <asp:TemplateField HeaderText="Mô tả"><HeaderTemplate>
                                                                    Mô tả
                                                                
</HeaderTemplate>
<ItemTemplate>
                                                                   
                    <asp:Label ID="lblDescription" runat="server" Text='<%# Eval("Description")%>'></asp:Label>                                             
</ItemTemplate>

<HeaderStyle HorizontalAlign="Left" Width="200px" />

<ItemStyle Height="40px" HorizontalAlign="Left" Width="200px" />
</asp:TemplateField>
                            <asp:TemplateField HeaderText="Group"><HeaderTemplate>
                                                                    Group
                                                                
</HeaderTemplate>
<ItemTemplate>
                                                                   
                    <asp:Label ID="lblGroup" runat="server" Text='<%# Eval("Group")%>'></asp:Label>                                             
</ItemTemplate>

<HeaderStyle HorizontalAlign="Left" Width="150px" />

<ItemStyle Height="40px" HorizontalAlign="Left" Width="150px" />
</asp:TemplateField>
                            <asp:TemplateField HeaderText="Channel"><HeaderTemplate>
                                                                    Channel
</HeaderTemplate>
<ItemTemplate>
                                                                  
                  <asp:Label ID="lblChannel" runat="server" Text='<%# Eval("Channel")%>'></asp:Label>                                               
</ItemTemplate>

<HeaderStyle HorizontalAlign="Left" Width="150px" />

<ItemStyle Height="40px" HorizontalAlign="Left" Width="150px" />
</asp:TemplateField>
                            <asp:TemplateField HeaderText="NPP"><HeaderTemplate>
                                                                    NPP
</HeaderTemplate>
<ItemTemplate>
                                                                  
                  <asp:Label ID="lblNPP" runat="server" Text='<%# Eval("NPP")%>'></asp:Label>                                               
</ItemTemplate>

<HeaderStyle HorizontalAlign="Left" Width="150px" />

<ItemStyle Height="40px" HorizontalAlign="Left" Width="150px" />
</asp:TemplateField>
                            <asp:TemplateField>
                                            <ItemTemplate>
                                            <asp:ImageButton ID="imgBtnChon" runat="server" CausesValidation="False" CommandName="chon"
                                                            Height="25px" Width="25px" ImageUrl="~/Images/check.png" />
                                                </ItemTemplate>
                                                            <ControlStyle BackColor="White" BorderColor="White" />
                                                            <FooterStyle BackColor="White" BorderColor="White" />
                                                            <HeaderStyle BackColor="White" BorderColor="White" />
                                                            <ItemStyle BackColor="White" BorderColor="White" />
                                           </asp:TemplateField>


</Columns>
</asp:GridView>
                                                    </td>
                                               </tr>
                                                
                                               
                                            </table>
                                        </div>
                                    </div>
                                    <!-- EndContent main-->
                               
                           
                                     
                                                
                    </dxpc:PopupControlContentControl>                
                </ContentCollection>
            </dxpc:ASPxPopupControl> 
     <div class="direct_container_right_titletop">
                     Mapping thông tin sản phẩm
                </div>
                 <hr />
                <!-- Button chuc nang-->
                <div class="direct_container_main">
                    <asp:ImageButton ID="imgBtnAdd" ToolTip="Tạo mới mghiệp vụ mapping thông tin khách hàng" onclick="imgBtnAdd_Click" CausesValidation="false" ImageUrl="~/Images/add.png" Width="32px" Height="32px" runat="server" />
                    <%--<asp:ImageButton ID="imgBtnSave" ToolTip="Mapping 02 thông tin khách hàng" onclick="imgBtnSave_Click" ImageUrl="~/Images/save.png" Width="32px" Height="32px" runat="server" />--%>
                    <asp:ImageButton ID="imgBtnDelete" CausesValidation="false" ToolTip="Xóa nghiệp vụ" onclick="imgBtnDelete_Click" ImageUrl="~/Images/delete.png" Width="32px" Height="32px" runat="server" />
                    
                </div>
                <!-- End Button chuc nang-->
     <cc1:TabContainer ID="TabContainer1" runat="server" ActiveTabIndex="0" 
            BackColor="#CCFFFF" Font-Names="Arial" 
            Width="100%">
            <cc1:TabPanel ID="TabPanel1" runat="server" HeaderText="Map thông tin" TabIndex="0">
                 <ContentTemplate>
                     <div class="direct_container_main">
                    <div class="direct_container_form_right">
                       <table border="0" width="100%">
                         <tr>
                            <td colspan="2">
                               Chọn các mã sản phẩm(SKU) trùng nhau từ 02 nhà phân phối
                            </td>
                        </tr>
                         <tr>
                            <td width="10%" align="right"><p class="direct_label">Mã đã Map</p></td>
                            <td width="90%" align="left">
                           
                            <asp:TextBox ID="txtMaSo" ReadOnly="true" Text="New" CssClass="input_code" runat="server"></asp:TextBox>
                            </td>
                        </tr>
                         <tr>
                        <td align="right"><p class="direct_label">Tên sản phẩm(Fimex)</p></td>
                            <td align="left">
                            <asp:TextBox ID="txtFimexSP" CssClass="input_full" runat="server"></asp:TextBox>
                            <asp:RequiredFieldValidator ControlToValidate="txtFimexSP" Display="None" ID="RFVMaHang"
                                   runat="server" ErrorMessage="Phải nhập tên sản phẩm!">
                                            </asp:RequiredFieldValidator>
                                            <cc1:ValidatorCalloutExtender TargetControlID="RFVMaHang" ID="ValidatorCalloutExtender1"
                                            runat="server" Enabled="True">
                                            </cc1:ValidatorCalloutExtender>
                           
                            </td>
                       </tr>
                       <tr>
                        <td align="right"><p class="direct_label">Nguyên giá</p></td>
                            <td align="left">
                            <asp:TextBox ID="txtPrice" CssClass="input_full" runat="server"></asp:TextBox>
                           <cc1:FilteredTextBoxExtender ID="FilteredTextBoxExtendertxtPrice" 
                                            runat="server" Enabled="True" FilterType="Numbers" 
                                            TargetControlID="txtPrice">
                                            </cc1:FilteredTextBoxExtender>
                            </td>
                       </tr>
                         <tr>
                            <td align="right"><p class="direct_label">Group</p></td>
                            <td align="left">
                                
                                <asp:DropDownList ID="ddlNganhHang" runat="server" 
                                             AutoPostBack="true"
                                            onselectedindexchanged="ddlNganhHang_SelectedIndexChanged">
                                            </asp:DropDownList>
                            </td>
                           
                        </tr>
                       
                         <tr>
                            <td align="right"><p class="direct_label">Channel</p></td>
                            <td align="left">
                             <asp:DropDownList ID="ddlNhanHieu" runat="server"></asp:DropDownList>
                                 <asp:Button ID="btnSave" runat="server" Text="Lưu" onclick="btnSave_Click"/>
                            </td>
                           
                        </tr>
                       <tr>
                       <td colspan="2">
                           <asp:LinkButton CausesValidation="false" onclick="LinkGetDKSH_Click" ID="LinkGetDKSH" runat="server">Click vào đây để chọn sản phẩm của DKSH</asp:LinkButton>
                       </td>
                       </tr>
                        <tr>
                       <td colspan="2">
                           <asp:LinkButton CausesValidation="false" onclick="LinkGetNMD_Click" ID="LinkGetNMD" runat="server">Click vào đây để chọn sản phẩm của Nhật Minh Dương</asp:LinkButton>
                       </td>
                       </tr>
                        </table>
                    </div>
                     <asp:GridView ID="grvProduct" runat="server" AutoGenerateColumns="False" 
                                         onrowdeleting="grvProduct_RowDeleting" DataKeyNames="MaSP" EnableModelValidation="True"><Columns>
                            <asp:TemplateField HeaderText="Stt">
                                <HeaderTemplate>
                                                                    STT
                                                                
                                         
                                </HeaderTemplate>
                            <ItemTemplate>
                                                                    <%# Container.DataItemIndex + 1 %>
                                                                
</ItemTemplate>

<HeaderStyle HorizontalAlign="Left" Width="50px" />

<ItemStyle Height="40px" HorizontalAlign="Left" Width="50px" />
</asp:TemplateField>
<asp:TemplateField HeaderText="Mã SKU"><HeaderTemplate>
                                                                    Mã SKU
                                                                
</HeaderTemplate>
<ItemTemplate>
                                                                  
                  <asp:Label ID="lblMaHangFM" runat="server" Text='<%# Eval("MaSP")%>'></asp:Label>                                               
</ItemTemplate>

<HeaderStyle HorizontalAlign="Left" Width="150px" />

<ItemStyle Height="40px" HorizontalAlign="Left" Width="150px" />
</asp:TemplateField>
<asp:TemplateField HeaderText="Sản phẩm"><HeaderTemplate>
                                                                    Sản phẩm
                                                                
</HeaderTemplate>
<ItemTemplate>
                                                                   
                    <asp:Label ID="lblTenHang" runat="server" Text='<%# Eval("TenSP")%>'></asp:Label>                                             
</ItemTemplate>

<HeaderStyle HorizontalAlign="Left" Width="200px" />

<ItemStyle Height="40px" HorizontalAlign="Left" Width="200px" />
</asp:TemplateField>
<asp:TemplateField HeaderText="Group"><HeaderTemplate>
                                                                   Group
                                                                
</HeaderTemplate>
<ItemTemplate>
                                                                  
                  <asp:Label ID="lblGroup" runat="server" Text='<%# Eval("Group")%>'></asp:Label>                                               
</ItemTemplate>

<HeaderStyle HorizontalAlign="Left" Width="150px" />

<ItemStyle Height="40px" HorizontalAlign="Left" Width="150px" />
</asp:TemplateField>
<asp:TemplateField HeaderText="Channel"><HeaderTemplate>
                                                                    Channel
                                                                
</HeaderTemplate>
<ItemTemplate>
                                                                  
                  <asp:Label ID="lblChannel" runat="server" Text='<%# Eval("Channel")%>'></asp:Label>                                               
</ItemTemplate>

<HeaderStyle HorizontalAlign="Left" Width="150px" />

<ItemStyle Height="40px" HorizontalAlign="Left" Width="150px" />
</asp:TemplateField>
<asp:TemplateField HeaderText="Nhà phân phối"><HeaderTemplate>
                                                                    Nhà phân phối
                                                                
</HeaderTemplate>
<ItemTemplate>
                                                                  
                  <asp:Label ID="lblNPP" runat="server" Text='<%# Eval("NPP")%>'></asp:Label>                                               
</ItemTemplate>

<HeaderStyle HorizontalAlign="Left" Width="150px" />

<ItemStyle Height="40px" HorizontalAlign="Left" Width="150px" />
</asp:TemplateField>


<asp:CommandField  ButtonType="Image" DeleteText="Xóa" 
                                                                DeleteImageUrl="~/images/delete.png" CausesValidation="False" HeaderText="Xóa" 
                                                                 ShowDeleteButton="True" >
<ControlStyle Height="25px" Width="25px" />

<ItemStyle Height="25px" Width="25px" />
</asp:CommandField>
</Columns>
</asp:GridView>
                    </div>
                 </ContentTemplate>
            </cc1:TabPanel>
             <cc1:TabPanel ID="TabPanel2" runat="server" HeaderText="Tìm kiếm" TabIndex="1">
                <ContentTemplate>
                     <div class="direct_container_main">
                        <div class="direct_container_form_right">
                            <table border="0" width="100%">
                                       
                                <tr>
                                    <td>
                                   

                                      <asp:GridView ID="grvBranch" runat="server" AutoGenerateColumns="False" 
                                                        DataKeyNames="itemkey" EnableModelValidation="True" 
                                                        onrowcommand="grvBranch_RowCommand" AllowPaging="true"  PageSize="10"
                                                        onpageindexchanging="grvBranch_PageIndexChanging">
                                                        <Columns>
                                                            <asp:TemplateField HeaderText="Stt">
                                                                <HeaderTemplate>
                                                                    STT
                                                                </HeaderTemplate>
                                                                <ItemTemplate>
                                                                    <%# Container.DataItemIndex + 1 %>
                                                                </ItemTemplate>
                                                                <HeaderStyle HorizontalAlign="Left" Width="50px" />
                                                                <ItemStyle Height="40px" HorizontalAlign="Left" Width="50px" />
                                                            </asp:TemplateField>
                                                            <asp:TemplateField HeaderText="Mã SKU(Fimex)">
                                                                <HeaderTemplate>
                                                                   Mã SKU(Fimex)
                                                                </HeaderTemplate>
                                                                <ItemTemplate>
                                                                  
                                                                    <asp:Label ID="lblMaSo" runat="server" Text='<%# Eval("itemkey")%>'></asp:Label>
                                                                </ItemTemplate>
                                                                <HeaderStyle HorizontalAlign="Left" Width="150px" />
                                                                <ItemStyle Height="40px" HorizontalAlign="Left" Width="150px" />
                                                            </asp:TemplateField>
                                                            <asp:TemplateField HeaderText="Mô tả">
                                                                <HeaderTemplate>
                                                                   Mô tả
                                                                </HeaderTemplate>
                                                                <ItemTemplate>
                                                                   
                                                                    <asp:Label ID="lblTenKH" runat="server" Text='<%# Eval("Description")%>'></asp:Label>
                                                                </ItemTemplate>
                                                                <HeaderStyle HorizontalAlign="Left" Width="200px" />
                                                                <ItemStyle Height="40px" HorizontalAlign="Left" Width="200px" />
                                                            </asp:TemplateField>
                                                             
                                                            
                                                             <asp:TemplateField>
                                                                 <ItemTemplate>
                                                                    <asp:ImageButton ID="imgBtnChon" runat="server" CausesValidation="False" 
                                                                    CommandName="chon" Height="25px" Width="25px" ImageUrl="~/Images/check.png" />
                                                                </ItemTemplate>
                                                                <ControlStyle BackColor="White" BorderColor="White" />
                                                                <FooterStyle BackColor="White" BorderColor="White" />
                                                                <HeaderStyle BackColor="White" BorderColor="White" />
                                                                <ItemStyle BackColor="White" BorderColor="White" />
                                                            </asp:TemplateField>
                                                        </Columns>
                                                    </asp:GridView>

                                    </td>
                                </tr>
                               
                            </table>
                        </div>
                    </div>
                </ContentTemplate>
            </cc1:TabPanel>
    </cc1:TabContainer>
     <dxpc:ASPxPopupControl ID="MessageBox" PopupHorizontalAlign="WindowCenter"  PopupVerticalAlign="WindowCenter" Font-Bold="true" HeaderText="DRM-S" runat="server" Height="91px" 
        Width="601px">
        <ContentCollection>
<dxpc:PopupControlContentControl ID="PopupControlContentControl1" runat="server" SupportsDisabledAttribute="True"></dxpc:PopupControlContentControl>
</ContentCollection>
    </dxpc:ASPxPopupControl>
    </ContentTemplate>
</asp:UpdatePanel>